<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	 <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/theme/jquery.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.ext.js"></script>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/skin/css/mobilecss/charge.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/skin/css/mobilecss/main.css">
    <style type="text/css">
        body {
            padding-bottom: 40px;
            
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
</head>
<body>
	<div class="container">
	
		<div style="border-color:#000;">
		 <p style="font-size: 0.9rem" id="addTitle">添加后台公告</p>
		 	<input type="hidden" id="id" name="id" value="${notice.id}">
	        <input type="text" id="title" name="title" placeholder="后台系统公告标题 " value="${notice.title}"  style="width: 94%">
	        <textarea rows="18" id="contents" cols="46">${notice.contents}</textarea>
		</div>
		<div style="margin-top: 0.5rem">
	            <button type="button" style="width: 100%" onclick="saveNotice()" id="saveNotice" >确认修改</button>
	    </div>
	</div>
	
	
	<%-- <div id="container" style="width: 100%; height: 799px; background: rgb(255, 255, 255);">
		<pre id="showContent">
		<pre style="white-space: pre-wrap; word-wrap: break-word; margin-left: 25px; margin-right: 25px;">
		<p style="text-align:center ;"><strong> ${notice.title}</strong> </p>
		<p>${notice.contents}</p>
		</pre>
		<p style="text-align: right;"><fmt:formatDate value="${notice.createTime}" pattern="yyyy-MM-dd" type="both"/>&nbsp;&nbsp;</p>
		</pre>
	
	</div> --%>
</body>
<script type="text/javascript">

	 function saveNotice (){
		$('#usersave').attr('disabled',"true"); //添加disabled属性 
		var title = $("#title").val();
		var id = $("#id").val();
		var contents = $("#contents").val();
		if(title==""){
			layer.alert("请填写主题");
			return;
		}
		if(contents==""){
			layer.alert("请填写公告内容");
			return;
		}
		$.post("${pageContext.request.contextPath}/admin/notice_edit.html",
	            {"title":title,"id":id,"contents":contents},
	       function(data){
	           	var json = eval("("+data+")");
	           	$('#usersave').removeAttr("disabled");  //移除disabled属性 
				if(json.statusCode =='200'){
					layer.msg(json.message, {icon: 1});
					window.location.href="${pageContext.request.contextPath}/admin/notice_list_mobile.html";
				}else{
					layer.msg(json.message, {shift: 6});
				}
	      });
	 }

</script>

</html>